package com.tiancheng.trade.settlement.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum CostTypeEnum {

    PL("PL", "平台应收"),
    ME("ME", "商户应收"),
    CU("CU", "营销金额"),
    SC("SC", "手续费");


    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<CostTypeEnum> found = Arrays.stream(CostTypeEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
